package com.yami.shop.bean.model;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * <p>
 * 用于存储用户发布的动态，包括文字、图片和视频
 * </p>
 *
 * @author EXiaoKe
 * @since 2025-04-14
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("tz_posts")
public class Post{
    @TableId(type = IdType.AUTO)
    private Long postId;

    private String userId;
    private String content;
    private String mediaUrl;

    @EnumValue
    private PostType type;

    @EnumValue
    private PostStatus status;

    private Date createdAt;
    private Date updatedAt;

    public enum PostType {
        TEXT("text"), IMAGE("image"), VIDEO("video");
        @EnumValue
        private final String value;
        PostType(String value) { this.value = value; }
        @JsonValue
        public String getValue() { return value; }
    }

    public enum PostStatus {
        PENDING("pending"), APPROVED("approved"), REJECTED("rejected");
        @EnumValue
        private final String value;
        PostStatus(String value) { this.value = value; }
        @JsonValue public String getValue() { return value; }
    }
}




